<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//键盘事件对象中的keyCode属性可以得到相应键的ASCII码值
			//1.keyup和keydown不区分大小写 a和A都是得到65
			document.addEventListener("keyup", function(e) {
				console.log(e);
				console.log(e.keyCode);
			})

			//2.keypress事件区分字幕大小写, a得到97和A得到65
			document.addEventListener("keypress", function(e) {
				console.log("press:" + e.keyCode);
			})
		</script>
	</body>
</html>
